RtOpenMutex

RtOpenMutex returns a handle to the named RTSS mutex.

Syntax

HANDLE RtOpenMutex(
    DWORD DesiredAccess,
    BOOL bInheritHandle,
    LPCTSTR lpName
);

Parameters

DesiredAccess

Ignored. The access to the mutex object. Only the SYNCHRONIZE access right is required to use a mutex; to change the mutex's security, specify MUTEX_ALL_ACCESS. The function fails if the security descriptor of the specified object does not permit the requested access for the calling process.

bInheritHandle

Ignored. If this value is TRUE, processes created by this process will inherit the handle. Otherwise, the processes do not inherit this handle.

lpName

A pointer to a null-terminated string that names the mutex to be opened. Name comparisons are case-sensitive.

Return Values

A handle to the mutex object if the function succeeds, NULL if the function fails

To get extended error information, call GetLastError.

Remarks

RtOpenMutex enables multiple processes to open handles of the same mutex object. The function succeeds only if some process has already created the mutex with RtCreateMutex. The calling process can use the returned handle in any function that requires a handle of a mutex object, such as a wait function.

Use RtCloseHandle to close the handle. The system closes the handle automatically when the process terminates. The mutex object is destroyed when its last handle has been closed.

Requirements

Header Rtapi.h
Library rtapi_w32.lib (Windows), Rtx_Rtss.lib (RTSS)

See Also:

RtCloseHandle

RtCreateMutex

RtReleaseMutex

IntervalZero.com | Support | Give Feedback